-
Notifications
You must be signed in to change notification settings - Fork 154
Fix wrong size propogation for absolute elements #878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
nicoburns
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, and thanks for the PR!
The core idea here looks correct to me (and the Flexbox test backs that up). A couple of comments:
- I notice you've modified both Flexbox and Block layout, but there is only a test for Flexbox layout. Could you add a test for Block layout too please?
- Relatedly, Grid layout doesn't have either a test or a fix. Could get a test for Grid layout (and if the test reveals it requires the fix, also the fix)
|
Hi, thanks for the feedback. I added the changes you requested. Hope the grid implementation is correct |
nicoburns
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now - thanks!
|
Would it make sense to only compute the value of and assign I understand absolute positioning is a rare case so it should not matter, and RunMode::ComputeSize is quite a short code path anyway being the extra potentially unnecessary operation, however I also think fully defined size for absolute item is a very common case (it is 100% of cases in our project at least), so it might be worth the branch |
Skipping computing size if a dimension is known is already implemented. As I'd skipping it if it's previously been computed and cached. However, we still need to lay out the contents of that node if it has any. And the size of those contents are important as they may exceed the size of the container (in which case the node may scroll if configured to do so) |
What I meant is this code: https://github.com/DioxusLabs/taffy/pull/878/files#diff-78a705bd422b6ec7ece906ca29973427ec10834766ca5bf1609459f0e4f539d5R2148 |
|
Ah yes, I see what you mean. That new computations isn't being skipped when it sometimes could be. |
Objective
Fixes #876.
Context
From comparing the debug logs between having the container
absolutevs in-flow, I noticed that thefinal_layout_passwas getting no known parent width for absolute but not for in-flow.Feedback wanted
node_inner_sizeafterdetermine_container_cross_size, but again not familiar with the CSS spec and its under constants so I didn't change it.